import { http } from '../utils/request.js'

// 获取所有文件信息
export const getAllFile = (user_id) => {
    return http.get(`/files/${user_id}`)
}

// 定义文件下载接口
export const downloadFile = (id) => {
    return http.get(`/download/${id}`, {
        responseType: 'blob' // 指定响应类型为 blob
    });
};

// 定义文件删除接口
export const deleteFile = (id) => {
    return http.delete(`/delete/${id}`);
}

// 定义导入文件接口
export const importFile = (file_id, user_id) => {
    return http.get('/testing',
        {
            params: {
                file_id: file_id,
                user_id: user_id
            },
            responseType: 'arraybuffer'
        },
    );
}
